FileExists
This command checks is a specified file exists on a device.
Group:Device Extensions
Syntax: [bOK =] Device.FileExists(sFileName)
bOK (Boolean) Optional – the success or failure of the command.
sFileName (String) specifies where on the mobile device the file should be found
vData (Variant) contains the data read from the file. String or binary data is allowed.
Example:
' For this sample code, first copy a file to the device.
Dim szBuf() As Byte
ReadBinaryFile("c:\\temp\\my-test-file.txt", szBuf)
Device.WriteFile("%PUBLIC%/my-dir/my-test-file.txt", szBuf, False)
' Check for the existence of the file
If Device.FileExists("%PUBLIC%/my-dir/my-test-file.txt") Then
App.MsgBox("Test file exists")
Else
App.MsgBox("Test file is missing")
End If
' Check for a non-existent file
If Device.FileExists("%PUBLIC%/my-dir/this-file-does-not-exist") Then
App.MsgBox("Failed to confirm nonexistent file")
Else
App.MsgBox("Nonexistent file confirmed")
End If
Supported Versions: RFgen 5.2.4.8 and higher.